﻿using System;
using System.Collections.Generic;
using System.Linq;
using Collection.Entities;
using System.Threading;
using Collection.Core;
namespace Collection.Platform
{
    static class Run
    {
        /// <summary>
        /// UI初始化
        /// </summary>
        private static void Initialize()
        {
            Console.Title = "灯塔采集";
            string title = "欢迎使用灯塔采集器";
            Console.SetCursorPosition((Console.WindowWidth - title.Length) / 2, 1);
            Console.WriteLine("欢迎使用灯塔采集器");
            Console.WriteLine();
            Console.WriteLine("1.输入字母【a】采集商品属性信息；");
            Console.WriteLine("2.输入字母【b】采集商品信息；");
        }

        static void Options()
        {
            string cmd;
            do
            {
                Console.WriteLine("请输入指令：");
                cmd = Console.ReadLine().ToLower();
            } while (cmd != "a" && cmd != "b" && cmd != "e" && cmd != "g" && cmd != "c" && cmd != "f" && cmd != "d");
            switch (cmd)
            {

                case "a":
                    {
                        Collector.Instance.GatherProperties();
                        break;
                    }

                case "b":
                    {
                        Collector.Instance.GatherCommodities();
                        break;
                    }
                default:
                    {
                        return;
                    }
            }
        }

        static void Main()
        {
            Initialize();
            Monitor m = new Monitor();
            Options();
            Console.Read();
        }


    }
    /*
    static class Run
    {
        /// <summary>
        /// UI初始化
        /// </summary>
        private static void Initialize()
        {
            Console.Title = "大头娃娃采集系统";
            string title = "欢迎使用大头娃娃超级采集";
            Console.SetCursorPosition((Console.WindowWidth - title.Length) / 2, 1);
            Console.WriteLine("欢迎使用大头娃娃超级采集");
            Console.WriteLine();
            Console.WriteLine("1.输入字母【a】采集商品属性信息；");
            Console.WriteLine("4.输入字母【b】将属性数据导入至顽皮街库；");
            Console.WriteLine("2 输入字母【c】整理单品信息；");
            Console.WriteLine("2.输入字母【d】采集商品信息；");
            Console.WriteLine("3.输入字母【e】将商品数据导入至顽皮街库；");
            Console.WriteLine("5.输入字母【f】商品图片处理（缩放）；");
            Console.WriteLine("6.输入字母【g】商品图片处理（下载）；");
        }

        static void Main()
        {
            Initialize();
            //创建监视器对象
            CollectMonitor monitor = new CollectMonitor();
            while (true)
            {
                Options();
            }
        }

        static void Options()
        {
            string cmd;
            do
            {
                Console.WriteLine("请输入指令：");
                cmd = Console.ReadLine().ToLower();
            } while (cmd != "a" && cmd != "b" && cmd != "e" && cmd != "g" && cmd != "c" && cmd != "f" && cmd != "d");
            switch (cmd)
            {
                case "d":
                    {
                        Collector.Instance.GatherCommodities(GetCatalogIds());
                        break;
                    }
                case "a":
                    {
                        Collector.Instance.GatherProperties(GetCatalogIds());
                        break;
                    }
                case "e":
                    {
                        Collector.Instance.ExportCommodities();
                        break;
                    }
                case "b":
                    {
                        Collector.Instance.GeneralizeAttribute();
                        Collector.Instance.ExportProperties();
                        break;
                    }
                case "c":
                    {
                        Collector.Instance.GeneralizeSingleProduct();
                        break;
                    }
                case "f":
                    {
                        ImageHandler.CreateThumbnail(Console.WriteLine);
                        break;
                    }
                case "g":
                    {
                        ImageHandler.DownloadPicture(Console.WriteLine);
                        break;
                    }
                default:
                    {
                        return;
                    }
            }
        }
    }
     */
}
